package testserver;

import java.io.PrintWriter;
import java.util.Random;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Process extends HttpServlet
{
  private static final long a = 1L;
  private Random b = new Random();

  private a a(int paramInt1, int paramInt2)
  {
    if ((paramInt1 >= 87) || (paramInt2 >= 91))
      return a.a;
    if (paramInt1 < 15)
      return a.b;
    if ((paramInt1 >= 57) && (paramInt1 < 62) && (paramInt2 >= 48) && (paramInt2 < 80))
      return a.c;
    return a.d;
  }

  private double a(double paramDouble1, double paramDouble2)
  {
    double d = this.b.nextDouble();
    return paramDouble1 / Math.pow(1.0D - d, 1.0D / paramDouble2);
  }

  private double a(double paramDouble)
  {
    double d = this.b.nextDouble();
    return -Math.log(1.0D - d) / paramDouble;
  }

  private long a(a parama)
  {
    long l = 0L;
    switch (a()[parama.ordinal()])
    {
    case 1:
      l = ()Math.ceil(a(50000.0D, 1.4D));
      break;
    case 2:
      l = ()Math.ceil(a(1000.0D, 1.5D));
      break;
    case 3:
      l = ()Math.ceil(this.b.nextDouble() * 500.0D);
      break;
    case 4:
      l = ()Math.ceil(a(7000.0D, 1.7D));
    }
    if (l > 10000000L)
      l = 10000000L;
    return l;
  }

  private long b(a parama)
  {
    long l = 0L;
    switch (a()[parama.ordinal()])
    {
    case 1:
      l = ()Math.ceil(a(0.0005D));
      break;
    case 2:
      l = ()Math.ceil(a(0.05D));
      break;
    case 3:
      l = ()Math.ceil(this.b.nextDouble() * 10.0D);
      break;
    case 4:
      l = ()Math.ceil(a(0.0025D));
    }
    return l;
  }

  private String b()
  {
    String str = "";
    for (int i = 0; i < 80; i++)
      str = str + (char)(this.b.nextInt(26) + 65);
    return str;
  }

  private String c(a parama)
  {
    String str1 = new String();
    long l = a(parama);
    String str2 = b();
    str1 = "<html><body><h1>Response</h1>";
    while (l > 0L)
    {
      str1 = str1 + "<br>" + str2;
      l -= 80L;
    }
    str1 = str1 + "<h2>End of Response</h2></body></html>";
    return str1;
  }

  private void d(a parama)
  {
    long l = b(parama);
    try
    {
      Thread.sleep(l);
    }
    catch (InterruptedException localInterruptedException)
    {
      localInterruptedException.printStackTrace();
    }
  }

  protected void doGet(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse)
  {
    int i = 0;
    int j = 0;
    try
    {
      i = Integer.parseInt(paramHttpServletRequest.getParameter("param1"));
      j = Integer.parseInt(paramHttpServletRequest.getParameter("param2"));
    }
    catch (NumberFormatException localNumberFormatException)
    {
      localNumberFormatException.printStackTrace();
    }
    if (i < 0)
      i = 0;
    if (i > 100)
      i = 100;
    if (j < 0)
      j = 0;
    if (j > 100)
      j = 100;
    a locala = a(i, j);
    d(locala);
    String str = c(locala);
    paramHttpServletResponse.setContentType("text/html");
    PrintWriter localPrintWriter = paramHttpServletResponse.getWriter();
    localPrintWriter.println(str);
    localPrintWriter.close();
  }

  protected void doPost(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse)
  {
  }
}

/* Location:           C:\Users\Ching Lih\Desktop\
 * Qualified Name:     testserver.Process
 * JD-Core Version:    0.6.0
 */